<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <title>配送关系管理商品明细（中心）</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
    
   
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>配送关系商品明细</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">采购目录管理</a></li>
            <li class="active"><a href="#">配送关系管理</a></li>
            <li class="active"><a href="#">配送商品明细</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="form-inline">
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">商品编码：</label>
                        <input class="form-control" type="text" id="goodsCode" name="goodsCode" placeholder="商品编码" />
                    </div>
                    <div class="form-group form-group-xs">
                       &nbsp;&nbsp;&nbsp; <label for="txtDrugForm">药品编码：</label>
                        <input class="form-control" type="text" id="drugCode" name="drugCode" placeholder="药品编码" ></input>
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">&nbsp;&nbsp;通用名：</label>
                        <input class="form-control" type="text" id="drugName" id="drugName" placeholder="通用名" />
                    </div>
                     <div class="form-group form-group-xs">
                        <label for="txtDrugForm">&nbsp;&nbsp;药品来源：</label>
                        <select class="form-control"  id="drugSource" name="drugSource">
                            <option selected="selected" value="">请选择</option>
                            <option value="国产">国产</option>
                            <option value="进口">进口</option>
                            <option value="不详">不详</option>
                        </select>
                     <!--   <select id="drugSource" name="drugSource" class="form-control"></select>    -->
                     <!--输入框格式  <input class="form-control" type="text" id="drugSource" id="drugSource" placeholder="药品来源" />   -->   
                    </div>
                    <button type="button"  onclick="gridSerch()"  class="btn btn-success btn-sm">查&nbsp;询</button>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="list4"></table>
        <div id="prowed2"></div>
 
    <table class="jqgrid" id="list4"></table>
<div style="margin-top: 10px;"></div>
</section>
<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript">

$(function () {
jQuery("#list4").jqGrid({
    url: "getBaseDelByCentreListSee.html",
    mtype: "POST",
    datatype: "json",
    autowidth: true,
    multiselect:true,
    height: 250,
    colNames:['商品编码','药品编码','通用名','剂型','规格','转换系数','单位','材质','药品来源','所属项目','操作'],
    colModel:[
      //  {name:'delRelId',index:'delRelId',key:true,hidden:true, width:10, sorttype:"date", align:"center"},
        {name:'goodsCode',index:'goodsCode', width:100, sorttype:"date", align:"center",
            formatter: function (val, opts, rowdata) {
                return "<a href=\"toBaseDelByCentreGoods.html?delRelId="+rowdata.delRelId+"\">"+val+"</a>";
                }   
        },
        {name:'drugCode',index:'drugCode', width:100, sorttype:false, align:"center"},
        {name:'drugName',index:'drugName', width:120, sorttype:false, align:"center"},
        {name:'formName',index:'formName', width:60, align:"center"},
        {name:'specName',index:'specName', width:80, align:"center",sorttype:false},
        {name:'factor',index:'factor', width:60, align:"center",sorttype:false},
        {name:'unit',index:'unit', width:60, align:"center",sorttype:false},
        {name:'materialName',index:'materialName', width:60, align:"center",sorttype:false},
        {name:'drugSource',index:'drugSource', width:60, sorttype:false, align:"center"},
        {name:'projectName',index:'projectName', width:140, sorttype:false, align:"center"},
        {name:'oper',index:'oper', width:120, align:"center",
            formatter : function(val, opts, rowdata) {
           //     return " <a href='${ctx}/baseDel/toBaseDelByCentreListManage.html?goodsCode="+rowdata.goodsCode+"'>设置配送关系</a> ";
            	return " <a href='${ctx}/baseDel/toBaseDelByCentreListManage.html?goodsCode="+rowdata.goodsCode+"'>设置配送关系</a><a href='${ctx}/baseDel/toBaseDelrelationByCentreListLog.html?goodsCode="+rowdata.goodsCode+"'>设置日志查看</a> ";
            //	return " <a href='${ctx}/baseDel/toBaseDelByCentreListManage.html?goodsCode="+rowdata.goodsCode+"'>设置配送关系</a><a href='${ctx}/baseDel/toBaseDelCentreByCompList.html?goodsCode="+rowdata.goodsCode+"'>配送关系查看</a> ";
            }   
        }
        
    ],
     rowNum: 10,
     rowList: [10, 20, 30],
     rownumbers: true,
     multiselect: true,
     pager: "#prowed2",
     viewrecords: true,
     caption: "商品明细",
     editurl:"proPlanItemListHis.jsp",
     jsonReader: {
         repeatitems: false,
         id: "delRelId"
     }
    
});
  /*    
	$("#drugSource").HNSelect({
	    url: "${pageContext.request.contextPath}/selectController/getDicSys.html", data: { ID: '112' },defaultselect:'${form.patternType}',  defaultText: "<option value=''>请选择</option>",
	});
     */
    
    
});

function gridSerch() {
    var goodsCode = $.trim($("#goodsCode").val());
    var drugCode = $.trim($("#drugCode").val());
    var drugName = $.trim($("#drugName").val());
    var drugSource = $.trim($("#drugSource").val());  
    $("#list4").jqGrid('setGridParam',{  
        datatype:'json',
        postData:{"goodsCode":goodsCode,
                "drugCode":drugCode,
                "drugName":drugName,
                "drugSource":drugSource}
    }).trigger("reloadGrid"); //重新载入  
}

    
    
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = parent.window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
    if(getQueryString("username")=="root"){
        $("#bedata1").show();
        $("#allDelete1").show();
        $("#bedata2").show();
        $("#allDelete2").show();
        
    }else if(getQueryString("username")=="yy001"){
        document.getElementById("yy001").style.display="";
    }else if(getQueryString("username")=="ps001"){
        document.getElementById("ps001").style.display="";
    }
    function editPsComp() {
        $('#editPsComp').modal({
            keyboard : true
        });
    }
    
    function stop(){
        var checked = false;
         $("input.cbox").each(function() {
             if($(this).is(":checked")) {
                 checked = true;
                 return false;
             };
         });
         
         if (!checked) {
             $.HN.message.alert('请选择要停用的条目', '提示信息', 'failed');
         }else{
     $.HN.message.confirm("确定要停用吗？", '', '').on(function (e) {
           if (e) {
               $.HN.message.alert('操作成功！', '提示信息', 'success');
               window.location.href="onSellDrugListCenter.jsp";
               
           }
       });
       }
    }
   $("#allDelete1").click(function(){
       var checked = false;
     $("input.cbox").each(function() {
         if($(this).is(":checked")) {
             checked = true;
             return false;
         };
     });
     
     if (!checked) {
         $.HN.message.alert('请选择要启用的条目', '提示信息', 'failed');
     }else{
         $.HN.message.confirm("确定要启用吗", '', '').on(function (e) {
              if (e) {
                  $.HN.message.alert('操作成功！', '提示信息', 'success');
                  window.location.href="onSellDrugListCenter.jsp";
                  
              }
          });
     }
     });
   
    function goJsp(n1){
        
        var opt ={
                url:"../../jsp/price/priceChangeExeDetailGrid.jsp",
                title:"newwindow",
style:{height:400,width:890,top:200,left:270}
        };
        $.HN.dialog.open(opt);
        
}
     
    
   
    
    
</script>
</body>
</html>